gtkgesture: Consume button release/touch end events if gesture was claimed
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 24 May 2017 16:22:00 +0000 (18:22 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 25 May 2017 14:25:59 +0000 (16:25 +0200)
In these situations we must perform the "is it claimed" check before removing
the (touch)point, as doing so when the gesture is empty will be too late if
the gesture actually claimed input.

gtk/gtkgesture.c

index caef7d4612ab89a6ba9bcaf79be8cb498a888144..d8885ea2ebd9720ad0ea93dc1323fa801a86697d 100644 (file)
@@ -693,6 +693,11 @@ gtk_gesture_handle_event (GtkEventController *controller,
            (event->type == GDK_TOUCHPAD_PINCH &&
             event->touchpad_pinch.phase == GDK_TOUCHPAD_GESTURE_PHASE_END))
     {
+      gboolean was_claimed;
+
+      was_claimed =
+        gtk_gesture_get_sequence_state (gesture, sequence) == GTK_EVENT_SEQUENCE_CLAIMED;
+
       if (_gtk_gesture_update_point (gesture, event, FALSE))
         {
           if (was_recognized &&
@@ -701,6 +706,8 @@ gtk_gesture_handle_event (GtkEventController *controller,
 
           _gtk_gesture_remove_point (gesture, event);
         }
+
+      return was_claimed && was_recognized;
     }
   else if (event->type == GDK_MOTION_NOTIFY ||
            event->type == GDK_TOUCH_UPDATE ||